class Solution(object):
    def titleToNumber(self, columnTitle):
        """
        :type columnTitle: str
        :rtype: int
        """
        length = len(columnTitle)
        value = 0
        for i in range(length - 1):
            value += pow(26, i + 1)
        for i in range(length):
            value += (ord(columnTitle[i]) - ord('A')) * pow(26, length - 1 - i)
        return value + 1


data = Solution()
columnTitle = "ZY"
print(data.titleToNumber(columnTitle))
